package com.xbai.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author xbai
 * @Date 2021/5/24
 */
@Configuration
public class GatewayConfig {

    @Bean
    public RouteLocator routes(RouteLocatorBuilder builder) {
        RouteLocator route = builder.routes()
                .route("path_route",
                        r -> r.path("/guonei")
                        .uri("http://news.baidu.com/guonei"))
                .build();
        return route;
    }
}
